﻿

namespace Tentacle.Utils
{
    using System;
    using System.Net;
    using System.Net.Sockets;
    using System.Security.Cryptography;
    using System.Text;
    using static System.Diagnostics.Debug;

    internal sealed class Hepler
    {
        static MD5 md5 = MD5.Create();

        public static void Send(string content, IPEndPoint iP, UdpClient udpClient)
        {
            var array = Encoding.UTF8.GetBytes(content);
            udpClient.Send(array, array.Length, iP);
        }

        public static string GetString(byte[] data)
        {
            return Encoding.UTF8.GetString(data);
        }

        public static string Md5(string content)
        {
            return Convert.ToBase64String(md5.ComputeHash(Encoding.UTF8.GetBytes(content)));
        }

        public static void Trace(object obj)
        {
            WriteLine(obj);
        }
    }
}
